package com.bbz.crawler.ip.proxy.pool.core.pipeline;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bbz.crawler.ip.proxy.pool.core.model.CrawlerProxyIp;
import com.bbz.crawler.ip.proxy.pool.service.ICrawlerProxyIpService;

import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;
import us.codecraft.webmagic.pipeline.Pipeline;

@Component
public class IpProxyPoolPipeline implements Pipeline {

	@Autowired
	ICrawlerProxyIpService crawlerProxyIpService;

	@Override
	public void process(ResultItems resultItems, Task task) {
		List<CrawlerProxyIp> list = resultItems.get("proxyIpList");
		crawlerProxyIpService.insertBatch(list);

	}

}
